<!-- 评审查询详情 -->
<template>
    <div class="edu-page-warp">
      <el-card shadow="never">
        <el-row type="flex" justify="space-between" class="con_title">
          <el-col :span="6">
            <h2 class="edu-page-title">{{$t('paperBlindTrial.reviewDetail')}}</h2>
          </el-col>
          <el-col :span="3" style="text-align: right;">
            <el-button @click="back">{{this.$t('common.btn.back')}}</el-button>
          </el-col>
        </el-row>
        <h2 class="edu-page-title">{{$t('common.text.baseInfo')}}</h2>
        <el-form label-suffix="：" label-width="135px">
            <el-row :gutter="10">
                <el-col v-for="item in label" :span="item.col?item.col:8" :key="item.prop">
                    <el-form-item :label="item.label">
                      <el-tag
                        v-if="item.prop==='finalResult' && data.finalResult"
                        :type="getType(data[item.prop])"
                      >{{ fieldChange(options.finalResultArr, data[item.prop]) }}</el-tag>
                      <span v-else-if="item.prop==='evaStatus'">
                        {{fieldChange(options.evaStatus, data[item.prop])}}
                      </span>
                      <span v-else-if="item.prop==='selectedFlag'">
                        {{fieldChange(options.selectedFlag, data[item.prop])}}
                      </span>
                      <span v-else-if="item.prop==='preDefenseFlag'">
                        {{fieldChange(options.preDefenseFlag, data[item.prop])}}
                      </span>
                      <span v-else>{{data[item.prop]}}</span>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
      </el-card>
    <el-card shadow="never">
      <div class="detail-table">
        <h2 class="edu-page-title">{{$t('paperBlindTrial.reviewResultTitle')}}</h2>
      </div>
      <el-table :data="tableData" stripe style="width: 100%">
        <el-table-column type="index" :label="$t('message.order')" align="center" :min-width="50"/>
        <el-table-column :label="$t('label.schoolTerm')" prop="yearTermI18n" show-overflow-tooltip :min-width="180"></el-table-column>
        <el-table-column :label="$t('achievementApply.thesisTitle')" prop="thesisTitle" show-overflow-tooltip :min-width="150"></el-table-column>
        <el-table-column :label="$t('paperBlindTrial.batchName')" prop="batchNo" show-overflow-tooltip :min-width="100"></el-table-column>
        <el-table-column :label="$t('paperBlindTrial.sendCount')" prop="evaCount" show-overflow-tooltip :min-width="80"></el-table-column>
        <el-table-column :label="$t('paperBlindTrial.sendTime')" prop="evaDate" show-overflow-tooltip :min-width="155"></el-table-column>
        <el-table-column :label="$t('paperBlindTrial.assessResult')" prop="finalResult" show-overflow-tooltip
        :formatter="(row) => { return fieldChange(options.resultType, row.finalResult); }" :min-width="100"></el-table-column>
      </el-table>
    </el-card>
    </div>
</template>

<script>
import { tutorAuditDetail, tutorCheck, reviewGetList } from "common/src/api/paperBlindTrial";
import baseData from '../common/baseData';
import commonMixins from 'common/src/views/practiceManagement/commonMixins';
export default {
    components: {
      baseData,
    },
    mixins: [commonMixins],
    props: {
      row: {
        type: Object,
        default: {}
      }
    },
    data() {
        return {
          data: {},
          label: [
              { label: this.$t('label.stuCode'), prop: 'stuNo' },
              { label: this.$t('label.stuName'), prop: 'stuName' },
              { label: this.$t('label.grade'), prop: 'grade' },
              { label: this.$t('label.trainingLevel'), prop: 'eduLevelI18n' },
              { label: this.$t('label.trainingCategory'), prop: 'eduModeI18n' },
              { label: this.$t('label.degreeCategory'), prop: 'degreeTypeI18n' },
              { label: this.$t('label.formLearning'), prop: 'studyFormI18n' },
              { label: this.$t('label.college'), prop: 'academyName' },
              { label: this.$t('paperBlindTrial.stuMajor'), prop: 'majorName' },
              { label: this.$t('paperBlindTrial.preDefenseFlag'), prop: 'preDefenseFlag' },
              { label: this.$t('paperBlindTrial.isDraw'), prop: 'selectedFlag' },
              { label: this.$t('paperBlindTrial.createBlindTime'), prop: 'selectDate' },
              { label: this.$t('paperBlindTrial.havSendNum'), prop: 'evaCount' },
              { label: this.$t('paperBlindTrial.havSendArticles'), prop: 'evaThesisCount' },
              { label: this.$t('paperBlindTrial.needPassNum'), prop: 'needPassCount' },
              { label: this.$t('paperBlindTrial.hasPassNum'), prop: 'passThesisCount' },
              { label: this.$t('paperBlindTrial.finallyResult'), prop: 'finalResult', type: 'tag' },
          ],
          options: {
            preDefenseFlag: [
              { label: this.$t('message.yes'), value: 'Y', type: 'success' },
              { label: this.$t('message.no'), value: 'N', type: 'danger' }
            ],
            selectedFlag: [
              { label: this.$t('paperBlindTrial.notDrawn'), value: 'UNBLIND', type: '' }, // 未抽盲
              { label: this.$t('paperBlindTrial.drawn'), value: 'Y', type: 'success' }, // 抽中
              { label: this.$t('paperBlindTrial.missed'), value: 'N', type: 'warning' } // 未中
            ],
            evaStatus: [
              { label: this.$t('paperBlindTrial.hasSend'), value: 'Y', type: 'success' },
              { label: this.$t('paperBlindTrial.notSend'), value: 'N', type: 'warning' }
            ],
            resultType: [], // 评审结果
            finalResultArr: [
              { label: this.$t('message.pass'), value: 'COMPLETE', type: 'success' },
              // { label: this.$t('paperBlindTrial.finished'), value: 'COMPLETE', type: 'success' },
              { label: this.$t('achievementApply.unfinished'), value: 'INCOMPLETE', type: 'danger' },
            ],
          },
          tableData: []
        };
    },
    computed: {

    },
    created() {
      },
    mounted() {
      let param = {
        BLIND_REVIEW_RESULT: 'resultType', // 评审结果字典
      };
      this.initOptions(param);
      this.data = this.row;
      this.getTableList();
    },
    methods: {
      back() {
        this.$emit('emit:back');
      },
      // 获取评审详情结果
      getTableList () {
        let param = {
          condition: {
            stuNo: this.row.stuNo
          },
          pageNum_: 1,
          pageSize_: 100
        };
        reviewGetList(param).then(res=>{
          if (res.code === 200) {
            this.tableData = res.data.list;
          }
        });
      },
      getType(val) {
        let option = this.options.finalResultArr.find(v => v.value == val);
        return option ? option.type : null
      },
    }
};
</script>

<style scoped lang="scss">
.con {
    background-color: white;
    padding: 20px;
    &_title {
        width: 100%;
        border-bottom: solid #ccc 2px;
        padding-bottom: 20px;
    }
    &_footer {
        display: flex;
        flex-direction: row-reverse;
        border-top: solid #ccc 1px;
        padding-top: 10px;
    }
}
.detail-table {
  margin-bottom: 20px;
}
</style>
